package br.com.lazyprogrammer.spaceshooter.screen;

import br.com.lazyprogrammer.spaceshooter.manager.FontManager;
import br.com.lazyprogrammer.spaceshooter.manager.ImageManager;
import br.com.lazyprogrammer.spaceshooter.model.renderer.WorldRenderer;
import br.com.limaogames.framework.gl.Camera2D;
import br.com.limaogames.framework.gl.SpriteBatcher;
import br.com.limaogames.framework.impl.GLGame;
import br.com.limaogames.framework.impl.GLScreen;
import br.com.limaogames.framework.math.Vector2;
import br.com.limaogames.framework.util.Display;

/**
 * Created by LimaoGames on 19/8/2014.
 */
public class StartScreen extends GLScreen {
    Camera2D guiCam;
    SpriteBatcher batcher;
    Vector2 touchPoint;

    public StartScreen(GLGame game) {
        super(game);

        guiCam = new Camera2D(glGraphics, WorldRenderer.FRUSTUM_WIDTH, WorldRenderer.FRUSTUM_HEIGHT);
        batcher = new SpriteBatcher(glGraphics, 10);
        touchPoint = new Vector2();
    }

    @Override
    public void update(float v) {

    }

    @Override
    public void present(float v) {
        new Thread(new Runnable() {
			@Override
			public void run() {
                while (!ImageManager.loadComplete
                        && !FontManager.loadComplete) {
                    try {
                        Thread.sleep(3000);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
                if (ImageManager.loadComplete &&
                        FontManager.loadComplete)
                game.setScreen(new MainScreen(glGame));
            }
        }).start();
    }

    @Override
    public void pause() {

    }

    @Override
    public void resume() {

    }

    @Override
    public void dispose() {

    }
}
